abf4d9
@@ -22,6 +22,8 @@
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
@@ -287,6 +289,22 @@
public RecordReader getRecordReader(InputSplit split, JobConf job, Reporter repo
         reporter, CombineHiveRecordReader.class);
   }
 
+  protected static partitionDesc getPartitionDescFromPath(
+      Map<String, partitionDesc> pathToPartitionInfo, Path dir) throws IOException {
+	// The format of the keys in pathToPartitionInfo sometimes contains a port
+	// and sometimes doesn't, so we just compare paths.
+    for (Map.Entry<String, partitionDesc> entry : pathToPartitionInfo.entrySet()) {
+      try {
+        if (new URI(entry.getKey()).getPath().equals(dir.toUri().getPath())) {			
+          return entry.getValue();
+        }
+      }
+      catch (URISyntaxException e2) {}
+    }
+    throw new IOException("cannot find dir = " + dir.toString()
+      + " in partToPartitionInfo!");
+  }
+
   static class CombineFilter implements PathFilter {
     private String pString;
 
